﻿using Guru.Framework.QueryBuilding;
using System.Collections.Generic;
using Guru.TransactionLogger.Source.DL;
using System;
using Guru.Framework.Base;

namespace Guru.TransactionLogger.Source.BO
{
    public class TransactionLogEntry : AbstractBaseBO
    {
        private int _UserId;
        private string _TransactionType;
        private int _LogObject;
        private DateTime _LogTime;
        private string _ControlTag;
        private string _ControlName;
        private string _FormName;
        private int _OBJID;

        public TransactionLogEntry(int userId)
        {
            UserId = userId;
            LogTime = DateTime.Now;
        }

        public int OBJID
        {
            set { _OBJID = value; AddChangeList("OBJID"); }
            get { return _OBJID; }
        }
        public string FormName
        {
            set { _FormName = value; AddChangeList("FormName"); }
            get { return _FormName; }
        }
        public string ControlName
        {
            set { _ControlName = value; AddChangeList("ControlName"); }
            get { return _ControlName; }
        }
        public string ControlTag
        {
            set { _ControlTag = value; AddChangeList("ControlTag"); }
            get { return _ControlTag; }
        }
        public DateTime LogTime
        {
            private set { _LogTime = value; AddChangeList("LogTime"); }
            get { return _LogTime; }
        }
        public int LogObject
        {
            set { _LogObject = value; AddChangeList("LogObject"); }
            get { return _LogObject; }
        }
        public string TransactionType
        {
            set { _TransactionType = value; AddChangeList("TransactionType"); }
            get { return _TransactionType; }
        }
        public int UserId
        {
            set { _UserId = value; AddChangeList("UserId"); }
            get { return _UserId; }
        }

        public string GetIdColumn()
        {
            return "OBJID";
        }

        public string GetTable()
        {
            return "TransactionLog";
        }

        public int Insert()
        {
            return (new TransactionLogEntryDL()).Insert(this);
        }

    }
}
